package lesson01.oop;

public class Student {

	private String sname;
	private int sno;
	public static void main(String[] args) {
		Student stu = new Student("张三", 10);
		System.out.println(stu);
		// 覆盖前：lesson01.oop.Student@15db9742
		// 覆盖后：Student [sname=张三, sno=10]
		
		// println(Object obj)  --> obj.toString()
	}
	
	@Override
	public String toString() {
		return "Student [sname=" + sname + ", sno=" + sno + "]";
	}
	
	public Student() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Student(String sname, int sno) {
		super();
		this.sname = sname;
		this.sno = sno;
	}
	public String getSname() {
		return sname;
	}
	public void setSname(String sname) {
		this.sname = sname;
	}
	public int getSno() {
		return sno;
	}
	public void setSno(int sno) {
		this.sno = sno;
	}
	
	
}
